import common from '../common'
import mod from '../mod'
import service from '@/utils/request'

const sysuser = {
    list(pageSize, page, isPagi) {
        return common.list(mod.sysuser, pageSize, page, isPagi)
    },
    add(data) {
        return common.add(mod.sysuser, data)
    },
    edit(data) {
        return common.edit(mod.sysuser, data)
    },
    delete(id) {
        return common.delete(mod.sysuser, id)
    },
    search(pageSize, page, data) {
        return common.search(mod.sysuser, pageSize, page, data)
    },
    get(id) {
        return common.get(mod.sysuser, id)
    },
    resetPasswd(id) {
        return service.patch(mod.sysuser + '/' + id).then(data => {
            return Promise.resolve(data)
        }).catch(err => {
            return Promise.reject(err)
        })
    },
    modifyPasswd(id, data) {
        return service.patch(mod.sysuser + '/' + id + '/modifyPasswd', data).then(data => {
            return Promise.resolve(data)
        }).catch(err => {
            return Promise.reject(err)
        })
    }
}

export default sysuser;